;(function($){
	$.fn.orso=function(opints){
		var preset={
			boxl:null,
			boxr:null,
			boxlrX:null,
			boxon:null,
			multiselect:false,
			idclass:true,
			boxlan:null,
			boxran:null,
			boxalllan:null,
			boxallran:null,
		};
		var outside=$.extend(true,preset,opints);
		if(outside.idclass){
			idclass="."
		}else{
			idclass="#"
		};
		$(outside.boxl + " " + outside.boxlrX).each(function(){
			$(this).bind("click", function(){
				if($(this).hasClass('on')){
    	            $(this).removeClass('on');
    	        }else{
        			$(this).addClass("on");
    	        }
			});
		})
		$(outside.boxr + " " + outside.boxlrX).each(function(){
			$(this).bind("click", function(){
				if($(this).hasClass('on')){
    	            $(this).removeClass('on');
    	        }else{
        			$(this).addClass("on");
    	        }
			});
		})
		
		function left(){
			var isno=$(outside.boxr).find(outside.boxlrX).hasClass(outside.boxon);
			var find=$(outside.boxr).children(idclass+outside.boxon);
			if(isno){
				toLeft(find);
			}else{
				alert("请选择一个！");
			};
		};
		function right(){
			var isno=$(outside.boxl).find(outside.boxlrX).hasClass(outside.boxon);
			var find=$(outside.boxl).children(idclass+outside.boxon);
			if(isno){
				toRight(find);
			}else{
				alert("请选择一个！");
			};
		};

		$(outside.boxlan).on("click",function(){
			left();
		});
		$(outside.boxran).on("click",function(){
			right();
		});
		
		function allleft(){
			var boxlrX = $(outside.boxr).find(outside.boxlrX);
			toLeft(boxlrX);
		};
		function allright(){
			var boxlrX = $(outside.boxl).find(outside.boxlrX);
			toRight(boxlrX);
		};
		
		function toLeft(boxlrX){
			if(boxlrX){
				boxlrX.siblings().removeClass(outside.boxon);
				for (var i = 0; i < boxlrX.length; i++) {
					$(boxlrX[i]).removeClass('on');
					var text = $(boxlrX[i]).attr("text");
					$(boxlrX[i]).html(text);
					$(boxlrX[i]).appendTo(outside.boxl);
				}
			}
		}
		function toRight(boxlrX){
			if(boxlrX){
				boxlrX.siblings().removeClass(outside.boxon);
				for (var i = 0; i < boxlrX.length; i++) {
					$(boxlrX[i]).removeClass('on');
					var text = $(boxlrX[i]).attr("text");
					var html ="<span style='width: 47%;float: left;'>"+text+"</span><input type='text' class='weight-spinner' />";
					$(boxlrX[i]).html(html);
					$(boxlrX[i]).appendTo(outside.boxr);
				}
				$('.weight-spinner').each(function(){
					$(this).ace_spinner({value:0,min:0,max:10000,step:1, on_sides: true, icon_up:'ace-icon fa fa-plus bigger-110', icon_down:'ace-icon fa fa-minus bigger-110', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});		
				})
			}
		}
		
		$(outside.boxalllan).on("click",function(){
			allleft();
		});
		$(outside.boxallran).on("click",function(){
			allright();
		});

	};
})(jQuery);



/**调用参数**/
/**
boxl:null,//左边大盒子
boxr:null,//右边大盒子
boxlrX:null,//移动小盒子
boxon:null,//点击添加属性
multiselect:false,//是否启用多选默认是false,启用时true;
idclass:true,//添加的属性是否为class//true=class; false=id;
boxlan:null,//单个向左移动按钮
boxran:null,//单个向右移动按钮
boxalllan:null,//批量向左移动按钮
boxallran:null,//批量向右移动按钮
**/